<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>兑换记录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/Product/css/page_duihuanjilu.css">
    <link rel="stylesheet" href="__PUBLIC__/Product/css/lib/animate.css">
    <script src="__PUBLIC__/Product/js/lib/flexible.js"></script>
</head>
<body style="background-color: #f4f4f4;">
    <div class="exchange_record_box">
        <!-- 头部 -->
        <div class="exchange_record_header">
            <p>兑换记录</p>
            <p><img class="goBack" src="__PUBLIC__/Product/img/fanhui.png"/></p>
        </div>
        <!-- 内容 -->
        <div class="box">
            <!-- <div class="exchange_record_list">
                <div class="img_box">
                    <img src="" alt="">
                </div>
                <div class="detail">
                    <p>话费充值100,首冲兑13兑币</p>
                    <p></p>
                    <p><span>￥99.80</span><span>X1</span><span>&gt;</span></p>
                </div>
            </div>
            <div class="exchange_record_list">
                <div class="img_box">
                </div>
                <div class="detail">
                    <p>话费充值100,首冲兑13兑币</p>
                    <p><span>￥99.80</span><span>X1</span><span>&gt;</span></p>
                </div>
            </div>
            <div class="exchange_record_list">
                <div class="img_box">
                </div>
                <div class="detail">
                    <p>话费充值100,首冲兑13兑币</p>
                    <p><span>￥99.80</span><span>X1</span><span>&gt;</span></p>
                </div>
            </div>
        </div> -->
    </div>
</body>
</html>
<script src="__PUBLIC__/Product/js/lib/jquery3.2.1.js"></script>
<script>
    $(function(){
    	$('.goBack').click(function(){
    		window.location.href = document.referrer; //返回上一页并刷新
    	});
        loadData();
        function loadData(){
            $.ajax({
                url: 'http://a.91jfk.com/Product/Pointexchange/ExchangeRecord',
                type: 'get',
                dataType: 'json',
                success: function (res) {
                    console.log(res);
                    var data = res.message;
                    if (res.code == '1') {
                        for(var i = 0;i < data.length;i++){
                            createdlist(data[i].show_pic,data[i].pname,data[i].shuxingzhi.substring(0, data[i].shuxingzhi.length - 1),data[i].cash_price,data[i].point_price,data[i].purchase_num);
                        }
                    }
                },
                error: function (err) {
                    console.log(err);
                }
            });
        }
        function createdlist(src,title,sku,price,point,num){
            var box = $('.box');
            if(price != '0' && point != '0'){   // 集分加现金
                var list = $('<div class="exchange_record_list"><div class="img_box"><img src="'+src+'" alt=""></div><div class="detail"><p>'+title+'</p><p>'+sku+'</p><p><span>￥'+price+'元+'+point+'集分</span><span>X'+num+'</span></p></div></div>');
                box.append(list);
            } else if(price != '0' && point == '0'){    // 纯集分
                var list = $('<div class="exchange_record_list"><div class="img_box"><img src="'+src+'" alt=""></div><div class="detail"><p>'+title+'</p><p>'+sku+'</p><p><span>￥'+price+'元+'+point+'集分</span><span>X'+num+'</span></p></div></div>');
                box.append(list);
            }
        }
    });
</script>